<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title>CSS的删除按钮</title>
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
    <style type="text/css">
        .img_div{
            display : inline-block;
            position : relative;
        }

        .img_div .delete{
            position : absolute;
            top : 5px;
            right : 5px;
            color: red;
            border: 1px solid red;
            text-align: center;
            cursor: pointer;
            border-radius: 20px;
            width : 20px;
            height : 20px;
            line-height: 20px;
        }
    </style>
</head>

<body>
    <h2>CSS的删除按钮</h2>
    <div class="img_div">
        <img src="image.jpg" width="300" height="200"/>
        <div class="delete">x</div>
    </div>
</body>
<script>
$(function () {
    //删除操作
    $('.delete').click(function () {
        $(this).parent().remove();
    })
})
</script>
</html>